Scientific Linux 6
Sponsored Link

Keep all histories of commands - psacct
2011/05/07
  Keep all histories of commands by accton. Histories of commands are kept in users' own history file but they are possible to delete by users himselves. So accton is useful because it is owned by root and users can not edit it.

[1] accton is included in psacct package. Install it.
[root@dlp ~]#
yum -y install psacct
[2] Start psacct. It's OK all, all histories of commands are kept.
[root@dlp ~]#
/etc/rc.d/init.d/psacct start

Starting process accounting:
[ OK ]

[root@dlp ~]#
chkconfig psacct on
[3] Output histories of commands by a command below.
[root@dlp ~]#
lastcomm

bash
S
fermi
ttyS0
0.01 secs Sat May 7 21:29

id
fermi
ttyS0
0.00 secs Sat May 7 21:29

bash
F
fermi
ttyS0
0.00 secs Sat May 7 21:29

consoletype
fermi
ttyS0
0.00 secs Sat May 7 21:29

bash
F
fermi
ttyS0
0.00 secs Sat May 7 21:29

dircolors
fermi
ttyS0
0.00 secs Sat May 7 21:29

bash
F
fermi
ttyS0
0.00 secs Sat May 7 21:29

tput
fermi
ttyS0
0.00 secs Sat May 7 21:29

tty
fermi
ttyS0
0.00 secs Sat May 7 21:29

bash
F
fermi
ttyS0
0.00 secs Sat May 7 21:29

hostname
fermi
ttyS0
0.00 secs Sat May 7 21:29

bash
F
fermi
ttyS0
0.00 secs Sat May 7 21:29

id
fermi
ttyS0
0.00 secs Sat May 7 21:29

lastcomm
root
ttyS0
0.00 secs Sat May 7 21:29

chkconfig
root
ttyS0
0.00 secs Sat May 7 21:29

psacct
root
ttyS0
0.00 secs Sat May 7 21:28

touch
root
ttyS0
0.00 secs Sat May 7 21:28

accton
S
root
ttyS0
0.00 secs Sat May 7 21:28

[4] If you'd like to output histories for a user, execute with '--user' option.
[root@dlp ~]#
lastcomm --user fermi

bash
S
fermi
ttyS0
0.01 secs Sat May 7 21:29

id
fermi
ttyS0
0.00 secs Sat May 7 21:29

bash
F
fermi
ttyS0
0.00 secs Sat May 7 21:29

consoletype
fermi
ttyS0
0.00 secs Sat May 7 21:29

bash
F
fermi
ttyS0
0.00 secs Sat May 7 21:29

dircolors
fermi
ttyS0
0.00 secs Sat May 7 21:29

bash
F
fermi
ttyS0
0.00 secs Sat May 7 21:29

tput
fermi
ttyS0
0.00 secs Sat May 7 21:29

tty
fermi
ttyS0
0.00 secs Sat May 7 21:29

bash
F
fermi
ttyS0
0.00 secs Sat May 7 21:29

hostname
fermi
ttyS0
0.00 secs Sat May 7 21:29

bash
F
fermi
ttyS0
0.00 secs Sat May 7 21:29

id
fermi
ttyS0
0.00 secs Sat May 7 21:29

[5] If you'd like to output histories for a command, execute with '--command' option.
[root@dlp ~]#
lastcomm --command vim

vim
fermi
ttyS0
0.06 secs Sat May 7 21:29

 
Tweet